//
//  ErWebViewController.m
//  ItemProject
//
//  Created by apple on 16/3/1.
//  Copyright © 2016年 YZQ. All rights reserved.
//

#import "ErWebViewController.h"
//屏幕适配
#define WIDTH [UIScreen mainScreen].bounds.size.width //当前屏幕的宽(用的机型屏幕尺寸)
#define HEIGHT [UIScreen mainScreen].bounds.size.height
#define W [UIScreen mainScreen].bounds.size.width / 375 //当前屏幕 / 6的屏幕的比例
#define H [UIScreen mainScreen].bounds.size.height / 667
@interface ErWebViewController ()
@property(nonatomic,retain)UIWebView *webView;
@end

@implementation ErWebViewController
-(void)dealloc
{
    [_webView release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    //返回按钮
    UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    backBtn.frame = CGRectMake(0, 10, 70, 50);
//    [backBtn setBackgroundColor:[UIColor redColor]];
    [backBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
    [backBtn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [backBtn setTitle:@"< 返回" forState:UIControlStateNormal];
    [self.view addSubview:backBtn];
    
    self.webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 50, self.view.frame.size.width, self.view.frame.size.height)];
    //加到视图
    [self.view addSubview:self.webView];
    //内存管理
    [_webView release];
    //数据解析
    [self dataHand];

}
-(void)backAction
{
    [self dismissViewControllerAnimated:YES completion:^{
        //
    }];
}
-(void)dataHand
{
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_urlStr]]];
    NSLog(@"%@",_urlStr);

//    [self dismissViewControllerAnimated:YES completion:^{
//        
//    }];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
